#include <QtGui>
#include <QtSql>

 class MyModel : public QSqlQueryModel {
     Q_OBJECT
 public:
     MyModel(QObject *parent, int us, bool bo);
     Qt::ItemFlags flags(const QModelIndex &index) const;
     QVariant data(const QModelIndex &index,
                   int role = Qt::DisplayRole) const;
     bool setData(const QModelIndex &index,
                  const QVariant &value, int role);
     int user_id;
     bool boss;
     bool old;
     void refresh();
 };

  //-----------------------------------------------
 class MyDSBDelegate : public QItemDelegate {
     Q_OBJECT
 public:
     MyDSBDelegate(double min=0.00,
                   double max=999999999.99,
                   double step=0.1,
                   int precision=2,
                   QObject *parent = 0);
     QWidget *createEditor(
                 QWidget *parent,
                 const QStyleOptionViewItem &option,
                 const QModelIndex &index) const;
     void setEditorData(QWidget *editor,
                        const QModelIndex &index) const;
     void setModelData(QWidget *editor,
                       QAbstractItemModel *model,
                       const QModelIndex &index) const;
     void updateEditorGeometry(
             QWidget *editor,
             const QStyleOptionViewItem &option,
             const QModelIndex &index) const;
 private:
     double m_min;
     double m_max;
     double m_step;
     int m_precision;
 };

 //---------------------------------------------
 class MyDEDelegate : public QItemDelegate {
     Q_OBJECT
 public:
     MyDEDelegate(bool calpopup = true,
                  QObject *parent = 0);
     QWidget *createEditor(
                 QWidget *parent,
                 const QStyleOptionViewItem &option,
                 const QModelIndex &index) const;
     void setEditorData(QWidget *editor,
                        const QModelIndex &index) const;
     void setModelData(QWidget *editor,
                       QAbstractItemModel *model,
                       const QModelIndex &index) const;
     void updateEditorGeometry(
             QWidget *editor,
             const QStyleOptionViewItem &option,
             const QModelIndex &index) const;
 private:
     bool m_calpopup;
 };
